package cn.edu.zut.sunday.base.controller;

import cn.edu.zut.sunday.config.R;
import cn.edu.zut.sunday.config.ResponseNotIntercept;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@Api("登录接口")
@RestController
@CrossOrigin
public class LoginController {
    @ResponseNotIntercept
    @ApiOperation(value = "进行简单的登录操作")
    @PostMapping("login")
    public R login() {
        return R.ok().data("token","admin");
    }

    //info
    @ResponseNotIntercept
    @ApiOperation(value = "默认登录信息")
    @GetMapping("info")
    public R info() {
        return R.ok()
          .data("roles","[admin]")
          .data("name","admin")
          .data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    }
}
